package com.gagakuai.transcation.jdbc;

import com.gagakuai.session.TransactionIsolationLevel;
import com.gagakuai.transcation.Transaction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/*
 * @program: common-starters
 * @description: jdbc事务
 * @author: houhong
 * @create: 2023-07-15 22:42
 */
public class JdbcTransaction implements Transaction {

    /*
    *  连接
    */
    protected Connection connection;
    /*
    *  数据源
    */
    protected DataSource dataSource;
    /*
    *  数据隔离级别
    */
    protected TransactionIsolationLevel level;

    protected  boolean autoCommit = true;


    public JdbcTransaction(DataSource ds, TransactionIsolationLevel desiredLevel, boolean desiredAutoCommit) {
        dataSource = ds;
        level = desiredLevel;
        autoCommit = desiredAutoCommit;
    }

    private static final Log log = LogFactory.getLog(JdbcTransaction.class);

    @Override
    public Connection getConnection() throws SQLException {
        return null;
    }

    @Override
    public void commit() throws SQLException {

    }

    @Override
    public void rollback() throws SQLException {

    }

    @Override
    public void close() throws SQLException {

    }

    @Override
    public Integer getTimeout() throws SQLException {
        return null;
    }
}